<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<div id="box"></div>
<script>
    const OBox = document.querySelector('#box')
    function loadImage(fileUrl, resolve, reject){
        const img = new Image()
        img.src = fileUrl
        img.onload = () => {
            resolve(img)
        }
        img.onerror = (error) => {
            reject(error)
            img.src = 'http://iwenwiki.com/api/vue3-image/create-vue3-2.png'
        }
        console.log(img.src)
        document.body.appendChild(img)
        OBox.innerHTML = img

    }

    const path = 'http://iwenwiki.com/api/vue3-image/create-vue3-10.png'
    loadImage(path,data => {
        console.log(data)
    }, error => {
        console.log(error)
    })

</script>
</body>
</html>
